//
//  Register_codeViewController.m
//  帮惠Mall
//
//  Created by reew on 2017/9/15.
//  Copyright © 2017年 reew. All rights reserved.
//

#import "Register_codeViewController.h"
#import <SVProgressHUD.h>
#import "Register_SetPasswordViewController.h"
@interface Register_codeViewController ()
@property (weak, nonatomic) IBOutlet UITextField *authCode;
@end

@implementation Register_codeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UILabel *leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 80, 45)];
    leftLabel.text = @"手机号";
    leftLabel.font = [UIFont systemFontOfSize:18];
    _phoneNum.leftViewMode = UITextFieldViewModeAlways;
    _phoneNum.leftView = leftLabel;
    _phoneNum.text = _phone;
    
    UILabel *leftLabe2 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 80, 45)];
    leftLabe2.text = @"验证码";
    leftLabe2.font = [UIFont systemFontOfSize:18];
    _authCode.leftViewMode = UITextFieldViewModeAlways;
    _authCode.leftView = leftLabe2;
    [_authCode becomeFirstResponder];
    
    self.navigationController.navigationBarHidden = YES;
}
- (IBAction)close:(UIButton *)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
    Register_SetPasswordViewController *vc = [segue destinationViewController];
    vc.phoneNum = self.phone;
    vc.memberNo = self.memberNo;
    vc.authCode = self.authCode.text;
    
}

- (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender{
    if ([_authCode.text isEqualToString:@""]) {
        [SVProgressHUD showErrorWithStatus:@"请输入验证码"];
        return NO;
    }else{
        return YES;
    }
    
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}
@end
